package com.haolp.sys.controller;

import com.haolp.sys.common.vo.JsonResultVO;
import com.haolp.sys.pojo.SysMenu;
import com.haolp.sys.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 小李
 * @version 1.0
 * @date 2021/10/8 10:57
 * C:\Users\华为\AppData\Roaming\baitushow
 */
@RestController
@RequestMapping("/menu/")
public class SysMenuController {
    @Autowired
    private SysMenuService sysMenuService;
    @RequestMapping("doUpdateSaveOnject")
    public JsonResultVO doUpdateSaveOnject(SysMenu sysMenu){
        sysMenuService.updateObject(sysMenu);
        return new JsonResultVO("update ok");
    }
    @RequestMapping("doSaveObject")
    public JsonResultVO doSaveObject(SysMenu sysMenu){
        sysMenuService.saveObject(sysMenu);
        return new JsonResultVO("save ok");
    }
    @RequestMapping("doFindZtreeMenuNodes")
    public JsonResultVO doFindZtreeMenuNodes(){
        return new JsonResultVO(sysMenuService.findZtreeMenuNodes());
    }
    @RequestMapping("doDelectObject")
    public JsonResultVO doDeleteObject(Integer id){
        sysMenuService.deleteObject(id);
        return new JsonResultVO("delete ok");
    }
    @RequestMapping("doFindObjects")
    public JsonResultVO doFindObjects(){
       //List<Map<String,Object>> list= sysMenuService.findObjects();
       // return new JsonResultVO(list);
        return new JsonResultVO(sysMenuService.findObjects());

    }
}
